angular.module('app')

.factory('alertService',function ($uibModal) {
    return {
        open:function(size,title,content){
            var modalInstance = $uibModal.open({
                animation:true,
                templateUrl:'./modal/alert.html',
                controller:'alertCtrl',
                size:size,
                resolve:
                {
                    item:{
                        title:title,
                        content:content
                    }
                }
            });
            return modalInstance;
        }
    }
});

alert.controller('alertCtrl',function ($scope,$uibModalInstance,item) {
    $scope.alertTitle = item.title;
    $scope.alertContent = item.content;
    $scope.ok = function () {
        $uibModalInstance.close('ok');
        if($scope.alertTitle == "登录错误"){
            location.href = "tpl/login/login.html";
        }
    };
});